17. Phonebook Commands > 17.10 AT^SPBG   Display phonebook entries in alphabetical order

17.10
AT^SPBG   Display phonebook entries in alphabetical order
AT^SPBG sorts the entries of the current phonebook in alphabetical order by name (the first six characters mat­ter). The sort order is described in Section 17.1, Sort Order for Phonebooks.
There are two ways to use AT^SPBG:
•
If the optional parameter <RealLocReq> equals 0 or is omitted the sorted entries will be sequentially num­bered. As these numbers are not identical with the location numbers stored in the various phonebooks AT^SPBG can be used for reading only. For example, it helps you find entries starting with matching charac­ters. Do not use the serial numbers to dial out or modify entries.
•
If parameter <RealLocReq>=1 is given by the write command, the response parameter <location> addi­tionally appended to each entry indicates the actual location number. This number can be used for editing with AT+CPBW or dialing with ATD><mem><n>. The first index number of each entry is only the serial number of the sorted list.
Before using the AT^SPBG write command it is recommended to query the number of records currently stored in the active phonebook (refer to test command parameter <used>). The test command also includes the param­eters <nlength> and <tlength>. Note that if SIM storage is selected the length may not be available. If stor­age does not offer format information, the format list should be empty parenthesises.
Syntax
Test Command  
Response(s)
Write Command  
Response(s)
Reference(s) 
PIN 
ASC0 
ASC1 
USB 
MUX1 
MUX2 
MUX3 
Charge 
Last 

Parameter Description
 
First index number in the sorted list where to start reading. The supported range is given in the test command response.
If <index 1> exceeds the upper bound <used>, "+CME ERROR: "invalid index" will be returned.
 
Last index number in the sorted list where to stop reading. The supported range is given in the test command response.
If <index2> is not given via write command, only the entry located at <index1> will be displayed.
If both <index1> and <index2> are in the range indicated by the test command parameter <used>, the list of entries will be output and terminated with OK.
If <index2> exceeds the range indicated by the test command parameter <used>, the list of entries will be output but terminated with a "+CME ERROR: "invalid index".
Note: The maximum value of <index2> is 255, regardless of the phonebook type and its range indicated by the parameter <used>. If a value greater than 255 is used the query returns no phonebook records, and only "+CME ERROR: invalid index" is shown.
 
Is a display of the "real" <location> of the entry required?
[0]
Do not show an entry's "real" location number. Parameter <location> will not be displayed.
1
Show the "real" location number as parameter <location> at the end of each entry.
 
String type phone number in format specified by <type>.
The number parameter may be an empty string.
 
<type>(num)
Type of address octet, which defines the used type of number (ton) and the numbering plan identification (npi).
Please consider that for types other than 129 or 145 dialing from phonebook with ATD><mem><n> is, depending on the network, not always possible (refer to GSM 04.08 subclause 10.5.4.7 for details). See also <type> of AT+CPBW.
Possible values are:
145
Dialing string <number> includes international access code character '+'
161
National number. Network support of this type is optional.
209
Dialing string <number> has been saved as ASCII string and includes non-digit characters other than "*", "#" or "+". Note that phonebook entries saved with this type cannot be dialed.
255
Dialing string <number> is a command to control a Supplementary Service, i.e. "*", "#" codes are contained. Network support of this type is optional.
129
Otherwise
 
<text>(str)(+CSCS)
Text assigned to the phone number. The maximum length for this parameter is given in test command response <tlength>.
 
<used>(num)
Value indicating the number of used locations in selected memory storage.
 
The location within phonebook memory at which the corresponding entry is located.
This location may be used for other commands (e.g. AT+CPBR or ATD><mem><n>)
 
Maximum length of phone number for "normal" locations. Depending on the storage, a limited number of loca­tions with extended memory is available per phonebook. Please refer to AT command AT+CPBW for detail.
 
Maximum length of <text> assigned to the telephone number. The value indicated by the test command is given in octets. If the <text> string is given in GSM characters, each character corresponds to one octet. If the <text> string is given in UCS2, the maximum number of characters depends on the coding scheme used for the alpha field of the SIM according to GSM 11.11, Annex B [26]. In the worst case the number of UCS2 char­acters is at least one less than half the number of GSM characters.


Notes
•
•
Users should be aware that when using this AT command quickly after SIM PIN authentication the SIM data may not yet be accessible, resulting in a short delay before the requested AT command response is returned. See Section 23.1, Restricted access to SIM data after SIM PIN authentication for further detail.

Examples

EXAMPLE 1


Using AT^SPBG without <RealLocReq>:
 
First run the AT^SPBG test command to find out the range of entries stored in the current phonebook.
TA returns the range, where 33 is the number of entries stored in the current phonebook.
Now, enter the write command. To obtain best results it is recommended to query the full range of entries. TA returns phonebook entries in alphabetical order.
The numbers at the beginning of each line are not the memory locations in the phonebook, but only serial numbers assigned to the entries' positions in the alphabetical list.
EXAMPLE 2


Using AT^SPBG with <RealLocReq>:
 
First run the AT^SPBG test command to find out the range of entries stored in the current phonebook.
TA returns the range, where 33 is the number of entries stored in the current phonebook.
The numbers at the end of each line are the memory locations in the phonebook and can be used for dialing or editing phonebook entries: